import store from './store';

import 'vant/lib/index.css';

import '@/views/workflow/assets/global.css';
import '@/views/workflow/assets/iconfont/iconfont.css';

import Ellipsis from './components/common/Ellipsis.vue';
import WDialog from './components/common/WDialog.vue';
import Avatar from './components/common/Avatar.vue';
import VueAMap, { initAMapApiLoader } from '@vuemap/vue-amap';
import '@vuemap/vue-amap/dist/style.css';

/*高德地图组件初始化*/
initAMapApiLoader({
	key: 'ebb9f6fb9beaec43fddcb22ab7406386',
	plugin: [
		'AMap.Autocomplete',
		/*  'AMap.ElasticMarker',
			'AMap.PlaceSearch',
			"AMap.MapType",*/
		'AMap.Geocoder',
		'AMap.Geolocation',
	],
});

export function initWorkflow(app) {
	app.use(store).use(VueAMap).component('Ellipsis', Ellipsis).component('WDialog', WDialog).component('Avatar', Avatar);

	window.$vueApp = app;
	window.$vCtx = app.config.globalProperties;

	import('./utils/Injection');

	app.config.globalProperties.routerAppend = (path, pathToAppend) => {
		return path + (path.endsWith('/') ? '' : '/') + pathToAppend;
	};

	return app;
}
